/**
 * 
 * @param id //省份 table Id
 */
industryId=null;
industryName=null;

industryPageIndex=1;
indestryPageCount=0;

function getIndustry(id){
	$.ajax({
		type : "get",
		async:false,
		datatype : "json",
		url : "../industryType/find/all/"+(industryPageIndex-1)+"/24",
		success : function(data) {
					var rst = JSON.parse(data);
					 DealAndShowMsg(data,false,false);
					loadIndustryTable(rst,id);
					if(rst.state==0){
						if(rst.result.len > 0){
							 var shu = rst.result.len;
							 indestryPageCount = Math.ceil(shu/24);
						}else{
							pagecount=0;

						}
						 $("#indusPager").pager({ pagenumber: industryPageIndex, pagecount: indestryPageCount, buttonClickCallback: indusPageClick });

					}
					}	
	});	
}

indusPageClick=function(pageNum){
	industryPageIndex=pageNum;
	getIndustry("IndustryList");
}
function loadIndustryTable(json,id){
	$("table[id='"+id+"'] tbody").empty();

	if(json.result.len>=4){
	$("table[id='"+id+"'] thead").html("<th>行业类型</th><th>操作</th><th>行业类型</th><th>操作</th><th>行业类型</th><th>操作</th><th>行业类型</th><th>操作</th>");
	for ( var i = 0; i < json.result.data.length; i++) {
		if((i%4)==0){
			
		$("table[id='"+id+"'] tbody").append("<tr></tr>");
		}
		var pId=getHeadIndexValue(i, json, "id");
		var pName=getHeadIndexValue(i, json, "name");
		var htm="<td>"+pName+"</td><td><input class='common_btn' type='button' value='选择' onclick = \"chooseloadIndustryTable("+pId+",'"+pName+"')\"></td>	";
		$("table[id='"+id+"'] tbody tr:last").append(htm)
		
	}
	}else{
		$("table[id='"+id+"'] thead").html("<th>行业类型</th><th>操作</th>");
		for ( var i = 0; i < json.result.data.length; i++) {
				
			$("table[id='"+id+"'] tbody").append("<tr></tr>");
			var pId=getHeadIndexValue(i, json, "id");
			var pName=getHeadIndexValue(i, json, "name");
			var htm="<td>"+pName+"</td><td><input class='common_btn' type='button' value='选择' onclick = \"chooseloadIndustryTable("+pId+",'"+pName+"')\"></td>	";
			$("table[id='"+id+"'] tbody tr:last").append(htm)
			
		}	
	}

}



